﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="../CSS/style5.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.showModalDialog.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.pager.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //表格囊括(客户编号和客户名称)
            Load();
        });
        function Load() {
            $.ajax({
                url: "SelectCustomer.asmx/SelectCustomers",
                type: "post",
                data: JSON.stringify({}),
                dataType: "json",
                contentType: "application/json",
                success: function (obj) {
                    $("#tab tr:gt(1)").remove();
                    var tb1 = $("#tab").get(0);
                    for (var i = 0; i < obj.d.length; i++) {
                        var tr = tab.insertRow(-1);
                        tr.insertCell(-1).innerHTML = obj.d[i].CusID || "";
                        tr.insertCell(-1).innerHTML = obj.d[i].CusName || "";
                        //双击
                        $("#tab tr:gt(1)").live("dblclick", function () {
                            var C = {
                                CusID: $(this).find("td:eq(0)").text(),
                                CusName: $(this).find("td:eq(1)").text()
                            };
                            window.returnValue = C;
                            window.close();
                        });
                    }
                }, error: function (xmlhttp) {
                    alert("错误：" + xmlhttp.responseText);
                }
            })
            
        };
    </script>
</head>
<body>
<table class="tableEdit" id="tab">
        <thead>
            <tr>
                <td colspan="2">
                    客户选择<span style="color:Red;font-weight:normal">(选择双击确定)</span>
                </td>
            </tr>
        </thead>
        <tr>
            <th>客户编号</th>
            <th>客户名称</th>
        </tr>
    </table>
</body>
</html>
